import React, { Component } from 'react'
import './article.scss'
import { PageHeader } from 'antd';
import axios from 'axios'

class Article extends Component {
  state = {
    title: '',
    desc: '',
    html: ''
  }

  componentDidMount() {
    axios.post('https://api.wxhnote.com/news_list', {
      page: 1,
      pageshow: 5
    }).then(res => {
      this.setState({
        title: res.data.data.list[0].news_title,
        desc: res.data.data.list[0].introduce,
        html: res.data.data.list[0].article
      })
    })



  }


  render () {
    return (
      <div className="article-wrap">
        <PageHeader
          className="site-page-header"
          onBack={() => this.props.history.push('/')}
          title="node"
          subTitle=""
        />
        <h1 className="aw-title">{this.state.title}</h1>
        <div className="ad-desc">{this.state.desc}</div>
        <div dangerouslySetInnerHTML={{__html: this.state.html}}></div>
      </div>
    )
  }
}

export default Article